.flex {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
}

ul.flex li.block {
    border-radius: 0.65rem;
    transition: background 0.3s ease;
}

.flex .block:not(.subheader) {
    flex: 0 1 50%;
    overflow: hidden;
}

.flex.card {
    margin: 0 0.75rem;
}

.flex.card .block:not(.subheader) {
    flex: 0 1 calc(50% - 0.5rem);
    min-height: 5rem;
}

.flex.stacked .block:not(.subheader) {
    margin-bottom: 0;
}

.flex.third .block:not(.large) {
    flex: 0 1 33.33%;
    max-width: 33.33%;
}

.flex.third.card .block:not(.large) {
    max-width: calc(33.33% - 0.5rem);
}

.flex .block.large,
.flex.card .block.large {
    flex: 0 1 100%;
}

.column {
    column-count: 3;
    margin: 1rem 0;
    line-height: 0;
}

.column > * {
    display: inline-block;
    width: 100%;
}

@media screen and (min-width: 451px) and (max-width: 900px) {
    .flex .block:not(.subheader),
    .flex.third .block:not(.subheader) {
        flex: 0 1 50%;
        max-width: 50%;
    }

    .flex.third.card .block:not(.subheader) {
        max-width: calc(50% - 0.5rem);
    }

    .column {
        column-count: 2;
    }
}

@media screen and (max-width: 450px) {
    .flex .block:not(.subheader),
    .flex.card .block:not(.subheader),
    .flex.third .block:not(.subheader),
    .flex.third.card .block:not(.subheader) {
        flex: 0 1 100%;
        max-width: 100%;
    }

    .column {
        column-count: 1;
    }
}

/* Gallery */

ul.flex.gallery li.block {
    flex-direction: column;
    justify-content: center;
}

ul.flex.gallery li.block p a.node,
ul.flex.gallery li.block > img + span,
ul.flex.gallery li.block > span.primary {
    display: none;
}

ul.flex.gallery li.block div {
    flex: initial;
    text-align: center;
}

ul.flex.gallery li.block img.main {
    position: relative;
    opacity: 1;
    height: initial;
    max-height: 35rem;
    max-width: calc(100% + 3rem);
    width: calc(100% + 3rem);
    left: 0;
    top: 0;
    flex: 0;
    margin-bottom: 0.5rem;
}

ul.flex.gallery li.block img.main:after {
    content: attr(alt);
}